<!DOCTYPE html>
<html lang="en">
<head>
	<title>回答</title>
	<include file="Public:header" />
 	 <script src="__JS__/LocalResizeIMG.js"></script>
	 <script src="__JS__/mobileBUGFix.mini.js"></script>
</head>
<body>
<header>
	<a href="javascript:void(0)" class="lft back"><i class="icon icon-back"></i><i>返回</i></a>
	<h5>回答问题</h5>
</header>

  <section class="zhuan">
    
<style>

/*****上传图片*****/
.addpic{ margin-top:30px;}
.addpic img{ height:80px;}
.addpic_imgList ul li{ float:left; margin-right:20px; height:80px; width:80px; overflow:hidden; margin-top:10px;   }
.addpic_imgList ul li .pictiemDel{ width:40px; height:40px; background-color:#000; color:#FFFFFF; text-align:center; line-height:40px; cursor:pointer; position:absolute; margin-top:-20px;}
.addpic_imgList #addPicBnt{ position:relative; }
.addpic_imgList #addPicBnt input{opacity:0; height:80px; border:1px solid #030303; width:80px; position:absolute; top:0px; left:0px;}
.ui-input-text { background-image: none; padding: .4em; margin: .5em 0; min-height: 1.4em; line-height: 1.4em; font-size: 16px; display: block; width: 98%; outline: 0;color: #333;text-shadow: 0 1px 0 #fff; padding:1%; outline: none;resize: none;border-radius: 9px; border:1px solid #B4B4B4; }
.ui-btn-inline{ display:inline-block; padding:0.5em 1em; margin-left:10px; min-width:60px; text-align:center   }
.ui-btn-up-c{ background-color:#F6F6F6;}
.ui-btn-up-b{  background-color:#2ab359; color:#fff ; }
.ui-btn-up-e{  background-color:#ffd600; color:#fff ; }
.ui-btn-up-r{  background-color:#e44141; color:#fff ; }
.group_tab a{ float:left; margin:5px; margin-top:0px;  }
</style>

<div data-role="content" data-theme="d" class="ui-content ui-body-d" role="main" style="padding:10px;">
<form action="#" method="get">
<textarea  class="ui-input-text" cols="40" placeholder="#<{$data['title']}>#" rows="8" name="textarea" id="memu_textarea" style=" height:120px;" ></textarea>	 
<input type="hidden" id="topic_id" value="<{$pid}>">
<input type="hidden" id="comment_id" value="<{$comment_id}>">


</form>

<div class="clear"></div>
<div class="postBnt mt10" style="text-align:left">   
<a  class="ui-btn-inline ui-btn-up-c back">取消</a> 
<a  id="memupostBnt"  class="ui-btn-inline ui-btn-up-b">发送</a> 
<a  id="memupostBntHover"  style="display:none"  class="ui-btn-inline ui-btn-up-c">发送中...</a> 
</div>

</div>
<!--<div class="addpic" style="margin:0; padding:10px;">
<div class="addpic_imgList">
<ul>	

<li id="addPicBnt"><img src="__LHGImages__/icon12.png" style="height:80px;"><input data-role="none" type="file" /></li>
</ul>
</div>
<div class="clear"></div>
<div class="light"></div>
</div>-->
  
 
 
<script type="text/javascript">
/********删除图片******/
function pictiemDel(obj){
   $(obj).parent().remove();
   var pic=$(obj).next("img").attr("src");
  // $.get("/index.php?c=member&a=uploadImgFrom_del",{img:pic});
}


$(function(){
/****提交表单********/
$("#memupostBnt").click(function(){
 var imgListObj=$(".pictiem img");
 var content="";
 var r=true;
 $.each(imgListObj,function(i,v){
    var img=$(v).attr('data');
	if(img=='__Img__/ajax-loader.gif'){
	 dialog("图片还在上传中，请上传完后再操作,或者取消未上传完的图片");
	 r=false;
	}
	if(img!="" && typeof(img) !== 'undefined'){
	 content+='<p><img src="'+img+'" /></p>';
	}
 });
 if(r===false)return false;
 var topic_id=$("#topic_id").val();
  var comment_id=$("#comment_id").val();
 var str=$("#memu_textarea").val();
 var id=$("#id").val();
 if(str==""){
   dialog("发送内容不能为空啊！！！");
   return false;
 }
 $(this).hide();
 $("#memupostBntHover").show();
 $.post("<{:U('Ask/do_ask_comment')}>",{pid:topic_id,comment_id:comment_id,content:str},
 function(data){
    if(data>0){
	 alert("发布成功");
	 window.location.href="<{:U('Ask/ask_show',array('topic_id'=>$pid))}>"
   }else{
     $("#memupostBnt").show();
	 $("#memupostBntHover").hide();
      dialog('发布失败');
   }
 });
})

 
/************上传图片**************/
var i=0;
$('#addPicBnt input').localResizeIMG({
             width: 800,
             quality: 0.8,
		     before: function (that, blob) {
			 var html='<li class="pictiem"><div class="pictiemDel" onClick="pictiemDel(this)">X</div><img id="_img'+i+'" src="__Img__/ajax-loader.gif"  ></li>';
			 $(html).insertBefore("#addPicBnt");
			 },
             success: function (result) {
			  $.post("<{:U('Group/uploadImgFrom_base64')}>",{formFile:result.clearBase64},function(data){
			   if(data!=0){
			    $("#_img"+i).attr("src","data:image/jpeg;base64,"+result.clearBase64);
			    $("#_img"+i).attr("data",data);
				  i++;	
			   }else{
			    dialog("上传失败");
				$("#_img"+i).parent().remove();
			   }		  
			  })
             }
         });
		
/*********上传图片结束*********/ 
	
});



</script>


 
	 <include file="Public:footer" />
</body>
</html>